<template>
  <div class="home-films-view">
    <div class="box">
      <ul>
        <li v-for="item in list" :key="item.url">
          <img :src="item.url" alt="" />
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import axios from "axios";
// import pic1 from "@/assets/1.jpg";
// import pic2 from "@/assets/2.jpg";
// console.log("===", pic1);
// console.log("===", pic2);

export default {
  name: "HomeFilmsView",

  data() {
    return {
      // list: [{ url: pic1 }, { url: pic2 }],

      list: [
        { url: require("@/assets/1.jpg") },
        { url: require("@/assets/2.jpg") },
      ],
    };
  },

  created() {
    // 这块，后端处理了 cors 可以跨域了
    // axios
    //   .post("http://localhost:3000/register", {
    //     username: "zhangsan",
    //     password: "zhangsan",
    //   })
    //   .then((res) => {
    //     console.log("res", res);
    //   });
    //
    // 这坨直接请求 i.maoyan.con 会跨域
    // axios
    //   .get(
    //     "https://i.maoyan.com/ajax/moreCinemas?movieId=0&day=2022-08-22&offset=0&limit=20&districtId=-1&lineId=-1&hallType=-1&brandId=-1&serviceId=-1&areaId=-1&stationId=-1&item=&updateShowDay=true&reqId=1661132149912&cityId=30&lat=22.62997421532846&lng=113.83205915652873&optimus_uuid=A52DCFB021BA11EDBFF1953403463E7E6E4A2FED2E2A452A8271B88038A2F72A&optimus_risk_level=71&optimus_code=10"
    //   )
    //   .then((res) => {
    //     console.log(res);
    //   });
    //
    // 下面这两个后端处理了就可以请求
    // axios.get("http://localhost:3000/maoyan").then((res) => {
    //   console.log(res);
    // });
    // axios.get("http://localhost:3000/maoyan2").then((res) => {
    //   console.log(res);
    // });
    //
    // 下面这两个后端处理了就可以请求,处理方式是使用的 http-proxy-middleware 这个中间件
    // axios
    //   .get(
    //     "http://localhost:3000/maoyan/ajax/moreCinemas?movieId=0&day=2022-08-22&offset=0&limit=20&districtId=-1&lineId=-1&hallType=-1&brandId=-1&serviceId=-1&areaId=-1&stationId=-1&item=&updateShowDay=true&reqId=1661132149912&cityId=30&lat=22.62997421532846&lng=113.83205915652873&optimus_uuid=A52DCFB021BA11EDBFF1953403463E7E6E4A2FED2E2A452A8271B88038A2F72A&optimus_risk_level=71&optimus_code=10"
    //   )
    //   .then((res) => {
    //     console.log(res);
    //   });
    // axios
    //   .get(
    //     "http://localhost:3000/maoyan/ajax/filterCinemas?ci=30&optimus_uuid=A52DCFB021BA11EDBFF1953403463E7E6E4A2FED2E2A452A8271B88038A2F72A&optimus_risk_level=71&optimus_code=10"
    //   )
    //   .then((res) => {
    //     console.log(res);
    //   });
    //
    // 直接请求漫画岛
    axios
      .get(
        "http://localhost:3000/mhd/comic_v2/customerview?apptype=8&appversion=1.0&channel=web-app&viewtype=1"
      )
      .then((res) => console.log(res));
  },
};
</script>

<style scoped lang="scss">
.home-films-view {
  .box {
    height: 98px;
    background-color: red;
  }
}
</style>
